Skip to content

fix: bound observation buffering during collection#2336

Draft
zeitlinger wants to merge 2 commits into
agent/fix-buffer-stripe-indexfrom
agent/bound-observation-buffer
Draft

fix: bound observation buffering during collection#2336
zeitlinger wants to merge 2 commits into
agent/fix-buffer-stripe-indexfrom
agent/bound-observation-buffer

Conversation

@zeitlinger

@zeitlinger zeitlinger commented Jul 23, 2026

Copy link
Copy Markdown
Member

Blocked by #2331

Summary

  • bound the collection spin wait and observation buffer
  • coordinate collection through explicit buffer generations and phase transitions
  • replay buffered observations before surfacing a collection timeout
  • skip timed-out native-histogram maintenance rather than throwing from observe()
  • document the generation handoff and striped-count protocol

This is stacked on the focused #2282 fix so the two Buffer concerns can be reviewed separately. It replaces the #2287 portion of #2297.

Fixes #2287

Ongoing discussion

  • Should the five-second collection deadline remain an internal default, or become publicly configurable? See the earlier discussion.
  • The bounded buffer currently applies backpressure rather than dropping observations. The earlier review suggested drop-on-overflow; this version avoids silent data loss but can block an observer while the generation remains active. See the earlier discussion.
  • The generation/phase handoff is a substantial concurrency change and should be reviewed independently of the simple stripe-index fix.

The earlier concerns about an unbounded second wait and exceptions escaping from native-histogram maintenance are addressed by this implementation.

Validation

  • mise run lint:fix
  • mise run build
  • ./mvnw test -pl prometheus-metrics-core -Dcoverage.skip=true -Dcheckstyle.skip=true

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ API changes detected — maintainer review required

This PR modifies the published API diff for the following module(s):

  • prometheus-metrics-core

Please review the changes in docs/apidiffs/current_vs_latest/ carefully before approving.

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant